require('../../assets/css/index.less');
require('../../assets/fitness-font/iconfont.css')
require('./couresdetail.less');

// 引入axios
const axios = require('../../utils/axios.js');

// 引入window
const { $, g } = require('../../utils/dom');

/**
 * window加载事件
 */
$(function () {

    /**
     * 返回上一页
     */
    g('#backbtn').addEventListener('click', () => {
        history.go(-1);
    })

    /**
     * 课程详情请求
     */
    let id1 = location.hash.substring(1);
    axios.get('/api/train/courseDetail', {
        params: {
            id: id1,
        }
    }).then(res => {
        if (res.data.errno === 0) {
            console.log('res.data.data :>> ', res.data.data);
            localStorage.setItem('fragments', JSON.stringify(res.data.data.fragments));
            g('#img').src = 'http://fitness.h5.itsource.cn:3701' + res.data.data.fragments[0].videoUrl;
        }
    })


})